import { defineConfig } from "vite";
import { resolve } from 'path';
import AutoImport from 'unplugin-auto-import/vite'
import uni from "@dcloudio/vite-plugin-uni";
import { UnifiedViteWeappTailwindcssPlugin as uvwt } from 'weapp-tailwindcss/vite';
// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': resolve(__dirname, './src'),
    },
  },
  plugins: [
    uni(),
    uvwt(),
    AutoImport({
      imports: ['vue', {
        "@dcloudio/uni-app": [
          'onLaunch',
          'onShow',
          'onHide',
          'onError',
          "onLoad",
          'onReady',
          'onUnload',
          'onPageNotFound',
          'onUnhandledRejection',
          'onThemeChange',
          'onResize',
          'onPush',
          'onPullDownRefresh',
          'onReachBottom',
          'onShareAppMessage',
          'onShareTimeline',
          'onTabItemTap',
          'onAddToFavorites',
          'onLaunchOption',
          'onPageScroll',
        ]
      }],
    })
  ],
  css: {
    postcss: {
      plugins: [
        require('tailwindcss'),
        require('autoprefixer')
      ]
    }
  }
});
